<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"`>
<head>
    <meta charset="UTF-8">
    <title>thymeleaf模板引擎</title>
    <link rel="stylesheet" th:href="@{/my.css}">
    <script type="text/javascript" th:src="@{/jquery-1.11.1.js}"></script>
</head>
<body>

    <h1 th:text="${msg}">hello thymeleaf</h1>
    <h1 th:utext="${msg}">hello thymeleaf</h1>
    <h1>student对象的类型的值</h1>
    <p th:text="${student}"></p>
    <p>学号: <span th:text="${student.id}"></span></p>
    <p>名字: <span th:text="${student.stuName}"></span></p>
    <p>年龄: <span th:text="${student.age}"></span></p>
    <p>生日: <span th:text="${#dates.format(student.birth,'yyyy-MM-dd')}"></span></p>
    <h1>
        使用表格展示学生信息列表
    </h1>

    <table border="1px" cellspacing="0">
        <tr>
            <td>学号</td>
            <td>名字</td>
            <td>年龄</td>
            <td>生日</td>
        </tr>
       <tr th:each="student:${students}">
           <td th:text="${student.id}"></td>
           <td th:text="${student.stuName}"></td>
           <td th:text="${student.age}"></td>
           <td th:text="${#dates.format(student.birth,'yyyy-MM-dd')}"></td>
       </tr>
    </table>

    <h1>th:if</h1>

    <p th:if="${1 < 2}"><button>删除按钮</button></p>
    <hr>

    <p th:text="${1+2}"></p>

    <hr>
    <div th:switch="${student.role}">
        <p th:case="'admin'">admin</p>
        <p th:case="'guster'">guster</p>
        <p th:case="*">other</p>
    </div>

    <hr>
    <input type="text" th:value="${student.stuName}">
</body>
</html>